/*
 * Copyright 2003-2006 (c) Live Media Pty Ltd. <argot@einet.com.au> 
 *
 * This software is licensed under the Argot Public License 
 * which may be found in the file LICENSE distributed 
 * with this software.
 *
 * More information about this license can be found at
 * http://www.einet.com.au/License
 * 
 * The Developer of this software is Live Media Pty Ltd,
 * PO Box 4591, Melbourne 3001, Australia.  The license is subject 
 * to the law of Victoria, Australia, and subject to exclusive 
 * jurisdiction of the Victorian courts.
 */


%ignore type_input_stream::read_buffer;
//%ignore type_input_stream::stack;

%fix_naming_to(type_input_stream, TypeInputStream);

%exception type_input_read_named_object
{
	BeginArgotExc
	ArgotExc( TYPE_NOT_DEFINED, SWIG_ValueError, "type not defined" )
	EndArgotExc
}

%input_stream_constructor

%include "TypeInputStream.h"

//%set_constructor_3(type_input_stream, type_input_init, type_map *, map, argot_read, ar, void *, data);
%set_destructor(type_input_stream, type_input_destroy);

%extend type_input_stream
{	
	void _set_type( type_element* element )
	{
		type_input_set_type(self, element);
	}

	type_map* get_type_map()
	{
		return type_input_type_map(self);
	}

	int read_buffer( void* buffer, int size )
	{
		return type_input_read_buffer(self, buffer, size);
	}
	
	type_stack* get_stack()
	{
		return type_input_stack(self);
	}
}

%set_input_stream_constructor
%add_bound_method( type_input_stream, int, read_object, type_input_read_object, int systemId );
%add_bound_method( type_input_stream, int, read_named_object, type_input_read_named_object, type_name * name );
%add_prop( type_input_stream, int, error, type_input_get_error, type_input_set_error );
%add_prop( type_input_stream, type_map*, type_map, type_input_stream_get_type_map, type_input_set_type_map );
//%add_readonly_prop( type_input_stream, type_stack*, stack, type_input_stream_get_stack );

%insert_read_callback

%stream_init_code


// ------------------------------------------------------------------------------------------------
%ignore type_output_stream::write_buffer;

%fix_naming_to(type_output_stream, TypeOutputStream);

%exception type_output_write_named_object
{
	BeginArgotExc
	ArgotExc( TYPE_EOF, SWIG_ValueError, "eof in output stream" )
	EndArgotExc
}

%output_stream_forward_decls

%include "TypeOutputStream.h"

//%set_constructor_3(type_output_stream, type_output_init, type_map *, map, argot_write ag, void *, data);
%set_destructor(type_output_stream, type_output_destroy);

%extend type_output_stream
{	
	/*int write_byte(char b)
	{
		return type_output_write_byte(self, b);
	}*/

	int write_buffer( void* buffer, int size )
	{
		return type_output_write_buffer(self, buffer, size);
	}

	int write_u16(unsigned short value)
	{
		return type_output_write_u16(self, value);
	}

	type_map* get_type_map()
	{
		return type_output_type_map(self);
	}
}

%add_prop( type_output_stream, int, error, type_output_get_error, type_output_set_error );
%add_readonly_prop( type_output_stream, type_map*, type_map, type_output_stream_get_type_map );



%insert_write_callback

%output_stream_code